package com.pilot.game.domain;

import com.fasterxml.jackson.annotation.JsonProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import javax.validation.constraints.*;
import java.io.Serializable;
import java.time.LocalDate;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * A Customer.
 */
@Entity
@Table(name = "用户")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Customer implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @NotNull
    @Column(name = "账号", nullable = false)
    private String accountName;

    @NotNull
    @Column(name = "密码", nullable = false)
    private String password;

    @Column(name = "代理")
    private String agency;

    @Column(name = "使用期限")
    private LocalDate deadline;

    @Column(name = "在线")
    private Integer online;

    @Column(name = "心跳时间")
    private ZonedDateTime heard;

    @Column(name = "登录状态")
    private Integer status;

    @Column(name = "qq")
    private String qq;

    @Column(name = "mobile")
    private String mobile;

    @Transient
    @JsonProperty
    private String code;

    // jhipster-needle-ent
    // ity-add-field - JHipster will add fields here, do not remove
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getAccountName() {
        return accountName;
    }

    public Customer accountName(String accountName) {
        this.accountName = accountName;
        return this;
    }

    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    public String getPassword() {
        return password;
    }

    public Customer password(String password) {
        this.password = password;
        return this;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getAgency() {
        return agency;
    }

    public Customer agency(String agency) {
        this.agency = agency;
        return this;
    }

    public void setAgency(String agency) {
        this.agency = agency;
    }

    public LocalDate getDeadline() {
        return deadline;
    }

    public Customer deadline(LocalDate deadline) {
        this.deadline = deadline;
        return this;
    }

    public void setDeadline(LocalDate deadline) {
        this.deadline = deadline;
    }

    public Integer getOnline() {
        return online;
    }

    public Customer online(Integer online) {
        this.online = online;
        return this;
    }

    public void setOnline(Integer online) {
        this.online = online;
    }

    public ZonedDateTime getHeard() {
        return heard;
    }

    public Customer heard(ZonedDateTime heard) {
        this.heard = heard;
        return this;
    }

    public void setHeard(ZonedDateTime heard) {
        this.heard = heard;
    }

    public Integer getStatus() {
        return status;
    }

    public Customer status(Integer status) {
        this.status = status;
        return this;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getQq() {
        return qq;
    }

    public Customer qq(String qq) {
        this.qq = qq;
        return this;
    }

    public void setQq(String qq) {
        this.qq = qq;
    }

    public String getMobile() {
        return mobile;
    }

    public Customer mobile(String mobile) {
        this.mobile = mobile;
        return this;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Customer customer = (Customer) o;
        if (customer.getId() == null || getId() == null) {
            return false;
        }
        return Objects.equals(getId(), customer.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getId());
    }

    @Override
    public String toString() {
        return "Customer{" +
            "id=" + getId() +
            ", accountName='" + getAccountName() + "'" +
            ", password='" + getPassword() + "'" +
            ", agency='" + getAgency() + "'" +
            ", deadline='" + getDeadline() + "'" +
            ", online='" + getOnline() + "'" +
            ", heard='" + getHeard() + "'" +
            ", status='" + getStatus() + "'" +
            ", qq='" + getQq() + "'" +
            ", mobile='" + getMobile() + "'" +
            "}";
    }
}
